//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.boot.framework.utils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.boot.framework.constants.PageConstants;

import java.util.Map;
import java.util.Objects;


public class Condition {
    public Condition() {
    }

    public static <T> IPage<T> getPage(Map<String, Object> query) {
        Object page = query.get(PageConstants.PAGE);
        Object limit = query.get(PageConstants.LIMIT);
        long pageNum = PageConstants.PAGE_NUM;
        long pageSize = PageConstants.PAGE_SIZE;
        if (!Objects.isNull(page)) {
            pageNum = Long.parseLong(String.valueOf(page));
        }
        if (!Objects.isNull(limit)) {
            pageSize = Long.parseLong(String.valueOf(limit));
        }

        return new Page<T>(pageNum, pageSize);
    }
}
